//
//  TTViewController.m
//  Tint
//
//  Created by Kevin Wu on 8/23/12.
//  Copyright (c) 2012 Telligenty. All rights reserved.
//

#import "TTViewController.h"


@implementation TTViewController


#pragma mark - Accessors

@synthesize viewAppeared = _viewAppeared;
@synthesize appearedTimes = _appearedTimes;


#pragma mark - Memory

- (id)init
{
    self = [super init];
    if ( self ) {
        _viewAppeared = NO;
        _appearedTimes = 0;
    }
    return self;
}

- (void)dealloc
{
    _viewAppeared = NO;
    _appearedTimes = 0;
    [super dealloc];
}


#pragma mark - UIViewController

- (void)viewDidAppear:(BOOL)animated
{
    [super viewDidAppear:animated];
    _viewAppeared = YES;
    _appearedTimes++;
}

- (void)viewDidDisappear:(BOOL)animated
{
    [super viewDidDisappear:animated];
    _viewAppeared = NO;
}


#pragma mark - Public

- (BOOL)isFirstTimeAppear
{
    if ( _viewAppeared ) {
        return ( _appearedTimes == 1 );
    }
    return ( _appearedTimes == 0 );
}


@end
